﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Model;
using BLL;
namespace ClassSystem
{
    public partial class ASPXiugai : System.Web.UI.Page
    {
        AchilveBLL bll = new AchilveBLL();
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Label1.Text = DateTime.Now.ToString();
            if (!Page.IsPostBack)
            {
                if (!string.IsNullOrEmpty(Request["ID"]))
                {
                    int ID = Convert.ToInt32(Request["ID"]);
                    AchileModel DM = bll.GetListAllk().Where(a => a.TID == ID).FirstOrDefault();
                    DM.TID = ID;
                    this.Label2.Text = DM.DutyDay;
                    this.TextBox1.Text = DM.CA;
                    this.TextBox2.Text = DM.CB;
                    this.TextBox3.Text = DM.CC;
                    this.TextBox4.Text = DM.CD;
                    this.TextBox5.Text = DM.CE;

                }
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            int ID = Convert.ToInt32(Request["ID"]);
            AchileModel DM = bll.GetListAllk().Where(a => a.TID == ID).FirstOrDefault();
            DM.TID = ID;
            DM.CA = this.TextBox1.Text.Trim();
            DM.CB = this.TextBox2.Text.Trim();
            DM.CC = this.TextBox3.Text.Trim();
            DM.CD = this.TextBox4.Text.Trim();
            DM.CE = this.TextBox5.Text.Trim();
            if (bll.updateA(DM))
            {
                Response.Redirect("ASPIndexAdmin.aspx");
            }
            else
            {
                Response.Write("alert('修改失败！')");
            }
        }
    }
}